﻿using System;
using System.Collections.Generic;
using GeoAPI.Geometries;

namespace NetTopologySuite.Operation.Distance
{
	public class ConnectedElementLocationFilter : IGeometryFilter
	{
		public static IList<GeometryLocation> GetLocations(IGeometry geom)
		{
			List<GeometryLocation> list = new List<GeometryLocation>();
			geom.Apply(new ConnectedElementLocationFilter(list));
			return list;
		}

		private ConnectedElementLocationFilter(IList<GeometryLocation> locations)
		{
			this._locations = locations;
		}

		public void Filter(IGeometry geom)
		{
			if (geom is IPoint || geom is ILineString || geom is IPolygon)
			{
				this._locations.Add(new GeometryLocation(geom, 0, geom.Coordinate));
			}
		}

		private readonly IList<GeometryLocation> _locations;
	}
}
